package com.ymatou.app.home.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.app.home.parameter.GetProductsByCategoryIdBean;
import com.ymatou.app.home.service.GetProductsByCategoryIdCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
/**
*获取通过分类商品信息接口
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetProductsByCategoryId{
	private static GetProductsByCategoryIdBean getproductsbycategoryidBean;
	private static GetProductsByCategoryIdCall getproductsbycategoryidCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取通过分类商品信息接口");
	}

	@Before
	public void caseUp() {
		getproductsbycategoryidBean=new GetProductsByCategoryIdBean();
		getproductsbycategoryidCall=new GetProductsByCategoryIdCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getproductsbycategoryidCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductsByCategoryId_001() {
		Logger.start(true,"获取通过分类商品信息成功");
		try {
			//10214'
			getproductsbycategoryidBean.setCategoryId(1182);
			getproductsbycategoryidBean.setPageIndex(1);
			getproductsbycategoryidBean.setUserId(1113);
			getproductsbycategoryidBean.setCookieId("autotest");
			getproductsbycategoryidBean.setIDFA("autotest");
			getproductsbycategoryidBean.setIMEI("autotest");
			getproductsbycategoryidCall.setData(getproductsbycategoryidBean);
			getproductsbycategoryidCall.callService();			
			Logger.comment("getproductsbycategoryidCall send:" + getproductsbycategoryidCall.getEntityString());
			Logger.comment("getproductsbycategoryidCall response:" + getproductsbycategoryidCall.getReturnData());
			Logger.verifyNotNull(getproductsbycategoryidCall.getProductlist(), "验证接口返回的数据不为空");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}